package jpb.util;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by haol on 2017/5/5.
 */
public class DateFormatUtil {

        public static String getYMd(){
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                return sdf.format(new Date());
        }

        public static String getYMd(Date time){
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                return sdf.format(time);
        }

        public static String getYMdHm(){
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
                return sdf.format(new Date());
        }
        public static String getYMdHm(Date time){
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
                return sdf.format(time);
        }
}
